import dic from "./Dictionary";

// function Translate(en = "") {
//   this.lang = "zh";
//   this.zh = dictionary[en];
//   this.en = en;
//   this.toString = (lang) => (lang == "zh" ? this.zh : this.en);
//   this.translate = function (enStr = "") {
//     this.lang == "zh" ? this.zh : enStr;
//   };
// }
function getZh(str = "") {
  return dic[str];
}
function getEn(zh = "") {
  return Object.keys(dic).find((key) => dic[key] == zh);
}
function translate(str = "") {
  switch (this.lang) {
    case "zh-CN":
      str = getZh(str);
      break;

    default:
      str = getEn(str);
      break;
  }
  return str;
}
export default {
  lang: "zh-CN",
  translate,
};
